package com.design.state;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

@Slf4j
public class Test {
    public static void main(String[] args) throws InterruptedException {
        Context context = new Context();
        RedState redState = new RedState();
        context.setState(redState);
        while (true){
            log.info("当前状态：{}", context.getState().getState());
            context.pull();
            TimeUnit.SECONDS.sleep(3 );
            log.info("当前状态：{}", context.getState().getState());
            context.pull();
            TimeUnit.SECONDS.sleep(3 );
            log.info("当前状态：{}", context.getState().getState());

        }
    }
}
